
#ifndef _UTIL_3DX_H_
#define _UTIL_3DX_H_

#include "xtypes.h"
#include "xaux.h"
#include "xmath.h"
#include "util_vector.h"
#include "util_matrix.h"


CMatrix4x4 fnZerosMatrix();
CMatrix4x4 fnIdentityMatrix();
CMatrix4x4 fnTranslateMatrix(float_t dx, float_t dy, float_t dz);
CMatrix4x4 fnScaleMatrix(float_t sx, float_t sy, float_t sz);
CMatrix4x4 fnXRotateMatrix(float_t angle);
CMatrix4x4 fnYRotateMatrix(float_t angle);
CMatrix4x4 fnZRotateMatrix(float_t angle);
CMatrix4x4 fnRotateMatrix(float_t angle, point3_t pt_start, vector3_t axis_dir);

CMatrix4x4 fnShearMatrix(float_t b, float_t c, float_t d, float_t f, float_t g, float_t h);
CMatrix4x4 fnSymmetryMatrix();




int_t xFactorial(int_t n);
float_t xLinearMap(float_t low_bound, float_t high_bound, float_t t);
point2_t xBiLinearMap(float_t left, float_t top, float_t right, float_t bottom, float_t u, float_t v);

float_t xEuclidDistance(point3_t p3d0, point3_t p3d1);
vector3_t xEuclidNormal(point3_t p3d0, point3_t p3d1, point3_t p3d2);

float_t xBernstein(INT i, INT n, float_t t);
point3_t xBezierSampling(point3_t* pi, INT n, float_t t);
point3_t xSquareBezierSampling(point3_t* pij, INT m, INT n, float_t u, float_t w);

point3_t xSphereSampling(float_t r, float_t u, float_t v);
point3_t xCirqueSampling(float_t rTrack, float_t rSmall, float_t u, float_t v);


#endif //_UTIL_3DX_H_
